import axios from 'axios';
import querystring from 'querystring';
interface IUpdate {
  name: string; //服务名称
  parentId: string; //上级类型 ID
  id: string; //服务类型 ID
}

interface IAdd {
  name: string; //	服务类型名称
  Pid?: string; //上级类别 ID
}
export const getServiceType = (params: { name?: string }) =>
  axios.get('/gen/servicetype', { params });

export const updateServiceType = (data: IUpdate) =>
  axios.put('/gen/servicetype', querystring.stringify({ ...data }));

export const addServiceType = (data: IAdd) =>
  axios.post('/gen/servicetype', querystring.stringify({ ...data }));

export const delServiceType = (id: string) =>
  axios.delete(`/gen/servicetype/${id}`);
